﻿using System;
using System.Collections.Generic;
using System.Text;
using XNAGuiLib.GuiLibResourceManager;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace XNAGuiLib.GuiLibButtons
{
    public class DefaultButton : ButtonObject
    {
        #region Constructor - DefaultButton(Game game, string name, Vector2 relPosition, Vector2 bounds, string text, ButtonObjectState state, ButtonSize buttonSize)
        public DefaultButton(Game game, string name, Vector2 relPosition, Vector2 bounds, string text, ButtonObjectState state, ButtonSize buttonSize)
            : base(game, name, relPosition, bounds, text, state)
        {
            // Console.WriteLine("HorizonsButton generated!");
            _buttonSize = buttonSize;
            // get the correct ResourceContentManager from the RManager instance ('default'-style for the DefaultButton
            ResourceContentManager rcm = GuiResourceManager.Instance(this.Game).StyleDefaultManager;
            // switch for the button's ButtonSize
            switch(_buttonSize)
            {
                // case: ButtonSize of 17px * 17px
                case ButtonObject.ButtonSize.BS017x017:
                    // set Hover, Clicked, Unclicked TextureObjects to new references of this kind, with the correct graphics for the buttonsize
                    Hover = new TextureObject(rcm.Load<Texture2D>("but_17x17_hover"), "hover", Statics.ZeroVector2, Statics.ZeroVector2);
                    Clicked = new TextureObject(rcm.Load<Texture2D>("but_17x17_clicked"), "clicked", Statics.ZeroVector2, Statics.ZeroVector2);
                    Unclicked = new TextureObject(rcm.Load<Texture2D>("but_17x17_unclicked"), "unclicked", Statics.ZeroVector2, Statics.ZeroVector2);
                    break;
                // case: ButtonSize of 67px * 17px
                case ButtonObject.ButtonSize.BS067x017:
                    // set Hover, Clicked, Unclicked TextureObjects to new references of this kind, with the correct graphics for the buttonsize
                    Hover = new TextureObject(rcm.Load<Texture2D>("but_67x17_hover"), "hover", Statics.ZeroVector2, Statics.ZeroVector2);
                    Clicked = new TextureObject(rcm.Load<Texture2D>("but_67x17_clicked"), "clicked", Statics.ZeroVector2, Statics.ZeroVector2);
                    Unclicked = new TextureObject(rcm.Load<Texture2D>("but_67x17_unclicked"), "unclicked", Statics.ZeroVector2, Statics.ZeroVector2);
                    break;
                // case: ButtonSize of 134px * 17px
                case ButtonObject.ButtonSize.BS134x017:
                    // set Hover, Clicked, Unclicked TextureObjects to new references of this kind, with the correct graphics for the buttonsize
                    Hover = new TextureObject(rcm.Load<Texture2D>("but_134x17_hover"), "hover", Statics.ZeroVector2, Statics.ZeroVector2);
                    Clicked = new TextureObject(rcm.Load<Texture2D>("but_134x17_clicked"), "clicked", Statics.ZeroVector2, Statics.ZeroVector2);
                    Unclicked = new TextureObject(rcm.Load<Texture2D>("but_134x17_unclicked"), "unclicked", Statics.ZeroVector2, Statics.ZeroVector2);
                    break;
                // case: default ButtonSize (will use 67px * 17px
                default:
                    // set Hover, Clicked, Unclicked TextureObjects to new references of this kind, with the correct graphics for the buttonsize
                    Hover = new TextureObject(rcm.Load<Texture2D>("but_67x17_hover"), "hover", Statics.ZeroVector2, Statics.ZeroVector2);
                    Clicked = new TextureObject(rcm.Load<Texture2D>("but_67x17_clicked"), "clicked", Statics.ZeroVector2, Statics.ZeroVector2);
                    Unclicked = new TextureObject(rcm.Load<Texture2D>("but_67x17_unclicked"), "unclicked", Statics.ZeroVector2, Statics.ZeroVector2);
                    break;
            }
            // set the TextColor used by this button to Black (best on the grey background)
            this.TextColor = Color.Black;

            this._initialized = true;
        }
        #endregion
    }
}
